//
//  Counter.swift
//  SwiftUIState
//
//  Created by 李煜 on 2024/7/31.
//

import SwiftUI

struct Counter: View {
  @Binding var count: Int
  var bgColor: Color
  
  var body: some View {
      Button(action: {
        count += 1
      }, label: {
        Text("\(count)")
          .frame(maxWidth: .infinity,maxHeight: .infinity)
          .padding()
          .font(.system(size: 40, weight: .bold, design: .rounded))
          .background(bgColor)
          .foregroundColor(.white)
          .clipShape(.circle)
      })

    }
}

#Preview {
  
  Counter(count: .constant(0), bgColor: .purple)
}
